<?php
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

if(!submitcheck('submit')) {
	
	showformheader('plugins&operation=config&do='.$pluginid.'&identifier=donkey_activity&pmod=pay', 'sms_submit');
	showtableheader();
	
	showtitle(lang('plugin/donkey_activity', 'admin_pay_credit'));
	$creditselect = array();
	$creditselect[0] = 'credit[id]';
	$creditselect[1][0] = array('', cplang('plugins_empty'));
	$i = 1;
	foreach($_G['setting']['extcredits'] as $id => $credit) {
		$creditselect[1][$i] = array($id, $credit['title']);
		$i++;
	}
	showsetting(lang('plugin/donkey_activity', 'admin_pay_credit_id'), $creditselect, $_LV['pay']['credit']['id'], 'select', '', 0, lang('plugin/donkey_activity', 'admin_pay_credit_id_desc'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_credit_ratio'), 'credit[ratio]', $_LV['pay']['credit']['ratio'], 'number', '', 0, lang('plugin/donkey_activity', 'admin_pay_credit_ratio_desc'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_credit_enabled'), 'credit[enabled]', $_LV['pay']['credit']['enabled'], 'radio');
	
	showtitle(lang('plugin/donkey_activity', 'admin_pay_under'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_under_enabled'), 'under[enabled]', $_LV['pay']['under']['enabled'], 'radio', '', 0, lang('plugin/donkey_activity', 'admin_pay_under_enabled_desc'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_under_intro'), 'under[intro]', $_LV['pay']['under']['intro'], 'textarea');

	showtitle(lang('plugin/donkey_activity', 'admin_pay_alipay'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_alipay_pid'), 'alipay[pid]', $_LV['pay']['alipay']['pid'], 'text', '', 0, lang('plugin/donkey_activity', 'admin_pay_alipay_pid_desc'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_alipay_key'), 'alipay[key]', $_LV['pay']['alipay']['key'], 'password', '', 0, lang('plugin/donkey_activity', 'admin_pay_alipay_key_desc'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_alipay_account'), 'alipay[account]', $_LV['pay']['alipay']['account'], 'text', '', 0, lang('plugin/donkey_activity', 'admin_pay_alipay_account_desc'));
	$alipayselect = array();
	$alipayselect[0] = 'alipay[apitype]';
	$alipayselect[1][0] = array('1', lang('plugin/donkey_activity', 'admin_pay_alipay_1'));
	$alipayselect[1][1] = array('2', lang('plugin/donkey_activity', 'admin_pay_alipay_2'));
	$alipayselect[1][2] = array('3', lang('plugin/donkey_activity', 'admin_pay_alipay_3'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_alipay_apitype'), $alipayselect, $_LV['pay']['alipay']['apitype'], 'select');
	
	showtitle(lang('plugin/donkey_activity', 'admin_pay_tenpay'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_tenpay_pid'), 'tenpay[pid]', $_LV['pay']['tenpay']['pid'], 'text', '', 0, lang('plugin/donkey_activity', 'admin_pay_tenpay_pid_desc'));
	showsetting(lang('plugin/donkey_activity', 'admin_pay_tenpay_key'), 'tenpay[key]', $_LV['pay']['tenpay']['key'], 'password', '', 0, lang('plugin/donkey_activity', 'admin_pay_tenpay_key_desc'));
	
	showsubmit('submit','submit');
	showtablefooter();
	showformfooter();
	
}else{
	$_G['gp_credit']['ratio'] = intval($_G['gp_credit']['ratio']);
	if(empty($_G['gp_credit']['ratio'])){
		$_G['gp_credit']['ratio'] = 1;	
	}
	$credit = serialize($_G['gp_credit']);
	$under = serialize($_G['gp_under']);
	$alipay = serialize($_G['gp_alipay']);
	$tenpay = serialize($_G['gp_tenpay']);
	cpmsg('donkey_activity:admin_pay_succeed', "action=plugins&operation=config&do={$pluginid}&identifier=donkey_activity&pmod=pay", 'succeed');
}
?>